{__NOLAYOUT__}
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport"
		  content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
	<title>我的</title>
	{include file="public/script" /}
	<style type="text/css">
		.container a{display: block;}
	</style>
</head>
<body>
	<div class="sectionH  sectionH2 mui-clearfix">
		<header class="mui-bar mui-bar-nav" style="">
			<a class="mui-icon mui-icon-left-nav  mui-pull-left" href="{:url('User/index')}" style="color: #727272;"></a>
			<h1 class="mui-title">我的活动</h1>
			<!--<a class="mui-icon mui-pull-right right1" href="assets-1.html"><img src="images/icon_setting.png"/></a>-->
		</header>
	</div>
	<div class="kong1"></div>
	<div class="lian_news_section11">
		<div class="mui-clearfix">
			<ul>
				<li style="width:50%;" onclick="javascript:location.href='{:url('User/myactive',['type'=>1])}';" {if condition="$type==1"}class="select"{/if}>参加过</li>
				<li style="width:50%;" onclick="javascript:location.href='{:url('User/myactive',['type'=>2])}';" {if condition="$type==2"}class="select"{/if}>举办过</li>
			</ul>
		</div>
	</div>
	<div class="kong1"></div>
	<div class="my_resource_section1" style="position: absolute;z-index: 2;width: 100%;height: 89%;">
		<div class="index_section4_2" style="position: absolute;width: 100%;z-index: 1;">
			<div class="container" style="position: relative;">
				{volist name="list" id="item"}
				<a href="{:url('Resource/resourceInfo',['id'=>$item.id])}">
					<div class="index_section4_2_1">
						<p class="p1 zzzzz">{$item.title}</p>
						<p class="p2">活动时间：{$item.begintime|date="Y年m月d日 H:i",###}-{$item.begintime|date="Y年m月d日 H:i",###} {$item.address}</p>
						<img src="{$item.thumb}"/>
					</div>
				</a>
				{/volist}
			</div>
		</div>
	</div>
	
</body>
<script>
    mui.init({
        pullRefresh: {
            container: '.my_resource_section1',
            down: {

            },
            up: {
                auto:false,
                contentrefresh: '正在加载...',
                callback: pullupRefresh
            }
        }

    });

    var count = 1;
    var finish = false;
    function pullupRefresh() {
        setTimeout(function() {
            ++count;
            var type = "{$type}";
            $.ajax({
                type: "POST",
                url: "{:url('User/myactive')}",
                data: {page:count,type:type},
                dataType: "json",
                success: function(data){
                    if(data.result_code==='0000'){
						var list = data.result_data.list;
                        if(list.length===0){
                            finish=true;
						}
                        mui('.my_resource_section1').pullRefresh().endPullupToRefresh((finish)); //参数为true代表没有更多数据了。
                        var table = document.body.querySelector('.container');
                        if(list.length>0){
							for(var i=0;i<list.length;i++){
                                var a = document.createElement('a');
                                var url = '/Resource/resourceInfo/id/'+list[i].id+'.html';
                                a.href=url;
                                a.innerHTML = '<div class="index_section4_2_2"><p class="p1">'+list[i]['title']+'</p><p class="p2">活动时间：'+DateToTime(list[i]['begintime'],'Y年m月d日 H:i')+'-'+DateToTime(list[i]['endtime'],'Y年m月d日 H:i')+' '+list[i].address+'</p><img src="'+list[i]['thumb']+'"/></div>';

                                table.appendChild(a);
							}
						}
                    }else if(data.result_code==='1111'){
                        mui.alert('请登录','',function(){
                            window.location.href='/Login/login';
                        });
                    }else{
                        mui.alert(data.result_info);
                    }

                }
            });
        }, 500);
    }
</script>
</html>